admin: Add API to OtBootloader to get name
authorColin Walters <walters@verbum.org>
Thu, 22 Aug 2013 10:33:04 +0000 (06:33 -0400)
committerColin Walters <walters@verbum.org>
Thu, 22 Aug 2013 11:37:21 +0000 (07:37 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=706548

src/ostree/ot-bootloader-syslinux.c
src/ostree/ot-bootloader-uboot.c
src/ostree/ot-bootloader.c
src/ostree/ot-bootloader.h

index 790db09a53f62f3602086916ad29342e52e31c80..3fe5df7bba7c3d8e5963ead0b251f67675f64727 100644 (file)
@@ -49,6 +49,12 @@ ot_bootloader_syslinux_query (OtBootloader *bootloader)
   return g_file_query_file_type (self->config_path, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == G_FILE_TYPE_SYMBOLIC_LINK;
 }
 
+static const char *
+ot_bootloader_syslinux_get_name (OtBootloader *bootloader)
+{
+  return "syslinux";
+}
+
 static gboolean
 append_config_from_boot_loader_entries (OtBootloaderSyslinux  *self,
                                         gboolean               regenerate_default,
@@ -267,6 +273,7 @@ static void
 ot_bootloader_syslinux_bootloader_iface_init (OtBootloaderInterface *iface)
 {
   iface->query = ot_bootloader_syslinux_query;
+  iface->get_name = ot_bootloader_syslinux_get_name;
   iface->write_config = ot_bootloader_syslinux_write_config;
 }
 
index e065a80f4173737e49e1b7367b94c4a435e1c052..43dfe1e1ad9c733a0f8e7b98d952a737ee8dcd0c 100644 (file)
@@ -53,6 +53,12 @@ ot_bootloader_uboot_query (OtBootloader *bootloader)
   return g_file_query_file_type (self->config_path, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL) == G_FILE_TYPE_SYMBOLIC_LINK;
 }
 
+static const char *
+ot_bootloader_uboot_get_name (OtBootloader *bootloader)
+{
+  return "U-Boot";
+}
+
 static gboolean
 create_config_from_boot_loader_entries (OtBootloaderUboot     *self,
                                         int                    bootversion,
@@ -153,6 +159,7 @@ static void
 ot_bootloader_uboot_bootloader_iface_init (OtBootloaderInterface *iface)
 {
   iface->query = ot_bootloader_uboot_query;
+  iface->get_name = ot_bootloader_uboot_get_name;
   iface->write_config = ot_bootloader_uboot_write_config;
 }
 
index 27edaa0af9196b688264f6278513674729c40b23..b74b3ab17188621bb770af2304e9d2f0d9079dbe 100644 (file)
@@ -37,6 +37,19 @@ ot_bootloader_query (OtBootloader  *self)
   return OT_BOOTLOADER_GET_IFACE (self)->query (self);
 }
 
+/**
+ * ot_bootloader_get_name:
+ *
+ * Returns: (transfer none): Name of this bootloader
+ */
+const char *
+ot_bootloader_get_name (OtBootloader  *self)
+{
+  g_return_val_if_fail (OT_IS_BOOTLOADER (self), NULL);
+
+  return OT_BOOTLOADER_GET_IFACE (self)->get_name (self);
+}
+
 gboolean
 ot_bootloader_write_config (OtBootloader  *self,
                             int            bootversion,
index 098291a81a3658e1717f7e56eeaf72eba2a67e46..e7ae0752db3bd2afc5f6a0ec8e2c7a6bcb283db8 100644 (file)
@@ -38,6 +38,7 @@ struct _OtBootloaderInterface
 
   /* virtual functions */
   gboolean             (* query)                  (OtBootloader  *self);
+  const char *         (* get_name)               (OtBootloader  *self);
   gboolean             (* write_config)           (OtBootloader  *self,
                                                    int            bootversion,
                                                    GCancellable  *cancellable,
@@ -48,6 +49,8 @@ GType ot_bootloader_get_type (void) G_GNUC_CONST;
 
 gboolean ot_bootloader_query (OtBootloader *self);
 
+const char *ot_bootloader_get_name (OtBootloader  *self);
+
 gboolean ot_bootloader_write_config (OtBootloader  *self,
                                      int            bootversion,
                                      GCancellable  *cancellable,